From: robertl Date: Sun, 14 Feb 2010 21:29:05 +0000 (+0000) Subject: Rough in preferences screen. Not functional yet. Has serious layout issues. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~199^2~60 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b165c8ef1742c46085aa42718656554e692afdac;p=gpsbabel.git Rough in preferences screen. Not functional yet. Has serious layout issues. --- diff --git a/gui/app.pro b/gui/app.pro index 87f7007c3..432acd677 100755 --- a/gui/app.pro +++ b/gui/app.pro @@ -1,4 +1,4 @@ -# $Id: app.pro,v 1.14 2010/01/05 15:01:30 robertl Exp $ +# $Id: app.pro,v 1.15 2010/02/14 21:29:05 robertl Exp $ # CONFIG += qt release @@ -29,55 +29,58 @@ mac:TARGET=GPSBabelFE win32:TARGET=GPSBabelFE unix:TARGET=gpsbabelfe-bin -FORMS += mainwinui.ui -FORMS += advui.ui FORMS += aboutui.ui -FORMS += trackui.ui +FORMS += advui.ui FORMS += filterui.ui -FORMS += wayptsui.ui -FORMS += rttrkui.ui -FORMS += miscfltui.ui FORMS += gmapui.ui +FORMS += mainwinui.ui +FORMS += miscfltui.ui +FORMS += preferences.ui +FORMS += rttrkui.ui +FORMS += trackui.ui FORMS += upgrade.ui +FORMS += wayptsui.ui +SOURCES += aboutdlg.cpp SOURCES += advdlg.cpp SOURCES += dpencode.cpp -SOURCES += map.cpp -SOURCES += latlng.cpp -SOURCES += gpx.cpp +SOURCES += filterdata.cpp +SOURCES += filterdlg.cpp +SOURCES += filterwidgets.cpp +SOURCES += format.cpp +SOURCES += formatload.cpp SOURCES += gmapdlg.cpp -SOURCES += aboutdlg.cpp -SOURCES += main.cpp +SOURCES += gpx.cpp SOURCES += help.cpp +SOURCES += latlng.cpp +SOURCES += main.cpp SOURCES += mainwindow.cpp -SOURCES += format.cpp -SOURCES += filterdata.cpp -SOURCES += formatload.cpp +SOURCES += map.cpp SOURCES += optionsdlg.cpp +SOURCES += preferences.cpp SOURCES += processwait.cpp -SOURCES += filterwidgets.cpp -SOURCES += filterdlg.cpp SOURCES += upgrade.cpp macx:SOURCES += serial_mac.cpp unix:SOURCES += serial_unix.cpp windows:SOURCES += serial_win.cpp -HEADERS += mainwindow.h -HEADERS += map.h -HEADERS += gmapdlg.h -HEADERS += gpx.h +HEADERS += aboutdlg.h +HEADERS += advdlg.h +HEADERS += appname.h HEADERS += babeldata.h +HEADERS += filterdata.h HEADERS += filterdlg.h -HEADERS += appname.h -HEADERS += advdlg.h -HEADERS += aboutdlg.h -HEADERS += help.h +HEADERS += filterwidgets.h HEADERS += format.h HEADERS += formatload.h +HEADERS += gmapdlg.h +HEADERS += gpx.h +HEADERS += help.h +HEADERS += mainwindow.h +HEADERS += map.h HEADERS += optionsdlg.h +HEADERS += preferences.h HEADERS += processwait.h -HEADERS += filterwidgets.h -HEADERS += filterdata.h HEADERS += setting.h HEADERS += upgrade.h diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index f09bc5d63..dc8d0a9b7 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: mainwindow.cpp,v 1.14 2010/02/14 05:33:37 robertl Exp $ +// $Id: mainwindow.cpp,v 1.15 2010/02/14 21:29:06 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -27,16 +27,17 @@ #include #include "mainwindow.h" -#include "babeldata.h" -#include "appname.h" -#include "help.h" -#include "advdlg.h" #include "aboutdlg.h" -#include "optionsdlg.h" +#include "advdlg.h" +#include "appname.h" +#include "babeldata.h" #include "filterdlg.h" -#include "processwait.h" #include "formatload.h" #include "gmapdlg.h" +#include "help.h" +#include "optionsdlg.h" +#include "preferences.h" +#include "processwait.h" #include "upgrade.h" #include "../gbversion.h" @@ -131,6 +132,7 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(closeActionX())); connect(ui.actionHelp, SIGNAL(triggered()), this, SLOT(helpActionX())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(aboutActionX())); + connect(ui.actionPreferences, SIGNAL(triggered()), this, SLOT(preferencesActionX())); connect(ui.inputFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(inputFormatChanged(int))); @@ -960,6 +962,14 @@ void MainWindow::aboutActionX() aboutDlg.exec(); } +//------------------------------------------------------------------------ +void MainWindow::preferencesActionX() +{ + Preferences preferences(0, formatList); + preferences.exec(); +} + + //------------------------------------------------------------------------ void MainWindow::helpActionX() { diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 49bab36f2..09d7713da 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: mainwindow.h,v 1.7 2009/09/15 18:04:03 robertl Exp $ +// $Id: mainwindow.h,v 1.8 2010/02/14 21:29:06 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -87,22 +87,23 @@ protected: void closeEvent(QCloseEvent*); private slots: - void inputFileOptBtnClicked(); - void inputDeviceOptBtnClicked(); - void inputOptionButtonClicked(); - void inputFormatChanged(int); + void aboutActionX(); + void applyActionX(); void browseInputFile(); - void outputFileOptBtnClicked(); - void outputDeviceOptBtnClicked(); - void outputOptionButtonClicked(); - void outputFormatChanged(int); void browseOutputFile(); - void moreOptionButtonClicked(); - void applyActionX(); - void aboutActionX(); - void helpActionX(); void closeActionX(); void filtersClicked(); + void helpActionX(); + void inputDeviceOptBtnClicked(); + void inputFileOptBtnClicked(); + void inputFormatChanged(int); + void inputOptionButtonClicked(); + void moreOptionButtonClicked(); + void outputDeviceOptBtnClicked(); + void outputFileOptBtnClicked(); + void outputFormatChanged(int); + void outputOptionButtonClicked(); + void preferencesActionX(); void resetFormatDefaults(); }; diff --git a/gui/mainwinui.ui b/gui/mainwinui.ui index 1e9a7ebe5..62b123243 100644 --- a/gui/mainwinui.ui +++ b/gui/mainwinui.ui @@ -631,6 +631,7 @@ File + @@ -660,6 +661,11 @@ Quit + + + Preferences... + + diff --git a/gui/preferences.cpp b/gui/preferences.cpp new file mode 100644 index 000000000..a5307ba8e --- /dev/null +++ b/gui/preferences.cpp @@ -0,0 +1,79 @@ +// +// Copyright (C) 2010 Robert Lipe +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 +// USA + + +#include +#include "preferences.h" + +class FormatListEntry : public QListWidgetItem { + public: + FormatListEntry(Format& fmt) : fmt_(fmt) { + setText(fmt.getDescription()); + bool enabled = !fmt.isHidden(); + setCheckState(enabled ? Qt::Checked : Qt::Unchecked); + } + + private: + Format& fmt_; +}; + +Preferences::Preferences(QWidget* parent, QList& formatList) : + formatList_(formatList) +{ + ui_.setupUi(this); + + // TODO: read from prefs. + // ui_.startupCheck->setChecked(true); + connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked())); + connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked())); + + connect (ui_.enableAllButton, SIGNAL(clicked()), this, SLOT(enableAllClicked())); + connect (ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked())); + + for (int i = 0; i < formatList_.size(); i++) { + FormatListEntry *item = new FormatListEntry(formatList[i]); + + ui_.enabledFormatsList->insertItem(0, item); + } +} + +void Preferences::enableAllClicked() +{ + for (int i = 0; i < ui_.enabledFormatsList->count(); i++) { + QListWidgetItem* item = ui_.enabledFormatsList->item(i); + item->setCheckState(Qt::Checked); + } +} + +void Preferences::disableAllClicked() +{ + for (int i = 0; i < ui_.enabledFormatsList->count(); i++) { + QListWidgetItem* item = ui_.enabledFormatsList->item(i); + item->setCheckState(Qt::Unchecked); + } +} + +void Preferences::acceptClicked() +{ + accept(); +} + +void Preferences::rejectClicked() +{ + reject(); +} diff --git a/gui/preferences.h b/gui/preferences.h new file mode 100644 index 000000000..15c95aa7e --- /dev/null +++ b/gui/preferences.h @@ -0,0 +1,42 @@ +#ifndef PREFERENCES_H_ +#define PREFERENCES_H_ + +// +// Copyright (C) 2010 Robert Lipe +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 +// USA + +#include "ui_preferences.h" +#include "format.h" + +class Preferences : public QDialog { + Q_OBJECT + + public: + Preferences(QWidget* parent, QList& formatList); + + private: + QList& formatList_; + Ui_Preferences ui_; + + private slots: + void enableAllClicked(); + void disableAllClicked(); + void acceptClicked(); + void rejectClicked(); +}; + +#endif // PREFERENCES_H_ diff --git a/gui/preferences.ui b/gui/preferences.ui new file mode 100644 index 000000000..6ed33529e --- /dev/null +++ b/gui/preferences.ui @@ -0,0 +1,130 @@ + + + Preferences + + + + 0 + 0 + 777 + 351 + + + + + 0 + 0 + + + + GPSBabel Preferences + + + + + + + 0 + 0 + + + + 1 + + + + General + + + + + 23 + 18 + 234 + 43 + + + + + + + Check for newer version on start. + + + true + + + + + + + Anonymously report usage data. + + + true + + + + + + + + + Formats + + + + + + + + Enabled Formats + + + + + + + true + + + + + + + + + + + Enable All + + + + + + + Disable All + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/gui/upgrade.cpp b/gui/upgrade.cpp index 5fd7b7262..22613fd4d 100644 --- a/gui/upgrade.cpp +++ b/gui/upgrade.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: upgrade.cpp,v 1.20 2010/02/14 05:33:37 robertl Exp $ +// $Id: upgrade.cpp,v 1.21 2010/02/14 21:29:06 robertl Exp $ /* Copyright (C) 2009, 2010 Robert Lipe, robertlipe@gpsbabel.org @@ -120,7 +120,6 @@ UpgradeCheck::updateStatus UpgradeCheck::checkForUpgrade(const QString ¤tV currentVersion = currentVersionIn; currentVersion.remove("GPSBabel Version "); upgradeCheckMethod = checkMethod; -// formatList_ = &formatList; QDateTime soonestCheckTime = lastCheckTime.addDays(1); if (!testing && QDateTime::currentDateTime() < soonestCheckTime) {